home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscSwapKitPalette / MiscSwapKit.subproj / MiscSwapContentsController.h < prev    next >
Encoding:
Text File  |  1994-09-24  |  3.6 KB  |  113 lines

  1. /* MiscSwapContentsController.h                 
  2.  *
  3.  * A very simple class for controlling swapAble views. A subclass is a must 
  4.  * to easily work with the MiscSwapView classes.
  5.  *
  6.  * Usage: Just create a instance and connect it to the view that holds the
  7.  *          should swap in when the trigger object is activated.
  8.  *          As an alternative you can set the tag this view is related to by 
  9.  *          creating an object with the right tag and setting it to be the
  10.  *          trigger. Its very easy to do this with the IB.
  11.  *
  12.  * Notes: If you create your own viewController you should really make a sub-
  13.  *          class of this object. Otherwise you might get problems if you do not
  14.  *          implement all the methods because the swapViews are very lazy in
  15.  *          respondsTo checking.
  16.  *
  17.  *          When the view willSwapOut you should ensure that NO colorWells are
  18.  *          activated!! This may cause some trouble or inconsistency!!!!
  19.  *
  20.  * Written by:         Thomas Engel
  21.  * Created:            24.01.1994 (Copyright 1994 Thomas Engel)
  22.  * Last Modified:     14.02.1994
  23.  */
  24.  
  25. //    This object is included in the MiscKit by permission from the author
  26. //    and its use is governed by the MiscKit license, found in the file
  27. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  28. //    for a list of all applicable permissions and restrictions.
  29.  
  30. #import <appkit/appkit.h>
  31.  
  32. @interface MiscSwapContentsController:Object
  33. {
  34.     id        swapView;            // the SwapView object (or a subclass)
  35.     id        view;                // the view that will be swapped into swapView
  36.     id        trigger;            // the trigger that will swap in this view
  37.     int        triggerTag;            // tag to compare with trigger's tag
  38.     id      delegate;            // notification of the view swapping in and out
  39. }
  40.  
  41. + initialize;
  42. - init;
  43. - setSwapView:aView;
  44. - swapView;
  45. - setView:aView;
  46. - view;
  47. - setTrigger:anObject;
  48. - trigger;
  49. - setTriggerTag:(int)tag;
  50. - (int)triggerTag;
  51.  
  52. - delegate;
  53. - setDelegate: aDelegate;
  54.  
  55. // These revert/ok msg are send to setup/save the contents of a view.
  56. // Only the revert msg is invoked by default. If you have to store some
  57. // data when swapping out implement a [self ok:self] msg inside willSwapOut.
  58.  
  59. - ok:sender;
  60. - revert:sender;
  61.  
  62. // These methods are used to inform this class of its fate.
  63. // The willSwapIn method calls [self revert] by default.
  64. // Always take care of calling super when overriding these methods !
  65.  
  66. - willSwapIn;
  67. - willSwapOut;
  68. - didSwapIn;
  69. - didSwapOut;
  70.  
  71. //- awakeFromNib;
  72. - read: (NXTypedStream *)stream;
  73. - write: (NXTypedStream *)stream;
  74.  
  75. @end
  76.  
  77.  
  78. @interface Object (MiscSwapContentsControllerNotification)
  79.  
  80. - willSwapViewIn: sender;
  81. - didSwapViewIn: sender;
  82. - willSwapViewOut: sender;
  83. - didSwapViewOut: sender;
  84.  
  85. @end
  86.  
  87.  
  88. /*
  89.  * History: 14.02.94 Changed the classes name to MiscSwapContentsController
  90.  *                     from the MiscSwapSubviewController becauses it fits better
  91.  *                     to what it really is.
  92.  *
  93.  *            24.01.94 Made it a Misc object and changed it to work with the
  94.  *                     new Misc stuff.
  95.  *
  96.  *            09.01.94 Added the ok/revert stuff.
  97.  *
  98.  *            08.01.94 Derived from my old swapViewdelegate. The code+methods
  99.  *                     were cleaned up a bit.
  100.  *
  101.  *
  102.  * Bugs: - No read/write.
  103.  *
  104.  *         - I could have automated the colorWell 'problem' but I don't think it
  105.  *           would be a good idea. It's not only a colorWell problem.
  106.  *           Swapping out has some affect on EVERY object that is linked to the 
  107.  *           outside world.
  108.  *           A buildin soultion can not handle every case where object will be
  109.  *           linked to the outside world.
  110.  *           ( I thank the guys form UNInspector Kit because they made the 
  111.  *             notice that problem through their release notes. Anyway I think
  112.  *             this kit has a more general approach towards inspectors. )
  113.  */